﻿<Window x:Class="Infrastructure.InteractionRequests.DefaultWindows.DefaultConfirmationWindow"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
           xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"  
           xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
           Width="300" Height="150" 
           Title="{Binding Title}"
           x:Name="confirmationWindow">
        <Grid x:Name="LayoutRoot" Margin="2">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <ContentControl HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="0"
                        ContentTemplate="{Binding ConfirmationTemplate, ElementName=confirmationWindow}"
                        Content="{Binding Content}"/>

        <Button x:Name="CancelButton" Content="Thoát" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,0,0" Grid.Row="1">
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="Click">
                        <ei:CallMethodAction TargetObject="{Binding ElementName=confirmationWindow}" MethodName="Close"/>
                    </i:EventTrigger>
                </i:Interaction.Triggers>
            </Button>
        <Button x:Name="OKButton" Content="Chấp nhận" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,79,0" Grid.Row="1">
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="Click">
                        <ei:ChangePropertyAction PropertyName="Confirmed" TargetObject="{Binding}" Value="True"/>
                        <ei:CallMethodAction TargetObject="{Binding ElementName=confirmationWindow}" MethodName="Close"/>
                    </i:EventTrigger>
                </i:Interaction.Triggers>
            </Button>
        </Grid>
</Window>
